import { use, useState } from 'react';
import '../assets/css/login.css'
import PassLogin from './PassLogin';
import SmsLogin from './SmsLogin';
function Login() {

     const [type,setType]=useState("短信登录");
     const [show,setShow]=useState(true);

     const checkType=()=>{

        setType(type == "密码登录" ? "短信登录" : "密码登录");
     }

     const loginForm=()=>{

        if(type==="短信登录"){

            return <PassLogin></PassLogin>
        }
        else{
            return <SmsLogin />
        }
         

     }
    

    const title="登录";
    const submit = () => {
        alert("登录成功")

    }
    return (
        <>

         {
            show && <div>显示</div>
             
         }
         <button onClick={()=>setShow(!show)}>隐藏</button>

        <div onClick={()=>checkType()}>{type}</div>
        
          {/* {
            loginForm()
          } */}
           
           {/* {
              type==='短信登录' ?  <PassLogin></PassLogin> : <SmsLogin></SmsLogin>
           } */}

           {

(()=>{

    if(type==='短信登录') return <PassLogin />
    else return <SmsLogin />

})()

            
           }
          
        </>
    )

}
export default Login;